package com.zz.common.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public abstract class DateTimeUtil {
	
    public static String getDateString(long ms) {
    	return getDateString(ms, "yyyy-MM-dd HH:mm:ss");
    }
    
    public static String getDateString(long ms, String format) {
    	Date curDate = new Date(ms);
		return getDateString(curDate, format);
    }
    
    public static String getNowDateString() {
    	return getNowDateString("yyyy-MM-dd HH:mm:ss");
    }
    
    public static String getNowDateString(String format) {
		Date curDate   =  new Date(System.currentTimeMillis());
		return getDateString(curDate, format);
    }
    
    public static String getDateString(Date date) {
    	return getDateString(date, "yyyy-MM-dd HH:mm:ss");
    }
    
    public static String getDateString(Date date, String format) {
    	SimpleDateFormat formatter = new SimpleDateFormat(format);
    	return formatter.format(date);
    }
}
